<template>
    <div class="child">
        <h3>子组件:哥哥</h3>
        <h4>我的玩具：{{ toy }}</h4>
      
        <!-- 发布数据给send-toy主题 -->
        <button @click="emitter.emit('send-toy',toy)">玩具给弟弟</button>
    </div>
</template>

<script setup lang="ts">
import { ref } from "vue";
//引入mitt
import emitter from "@/util/emitter";

const toy = ref('奥特曼');

</script>

<style scoped>
.child {
    border: 1px solid #ccc;
    padding: 10px;
    margin: 10px 0;
    background-color: #f0f0f0;
}
</style>
